package simple

// https://leetcode.cn/problems/linked-list-cycle/?envType=problem-list-v2&envId=linked-list&difficulty=EASY
// 141环形链表
// todo 存在错误
func hasCycle(head *ListNode) bool {
	step1 := head
	step2 := head
	for step1.Next == nil || step2.Next.Next == nil {
		step1 = step1.Next
		step2 = step2.Next.Next
		if step1.Val == step2.Val {
			return true
		}
	}
	return false
}
